class Admin::TagsController < AdminController
  
  after_filter :sweep_sitemap_cache
  
  def create
    @tag = Tag.new(params[:tag])

    respond_to do |format|
      if @tag.save
        flash[:success] = 'Tag was successfully created.'
        format.html { redirect_to admin_blog_posts_url }
      else
        flash[:error] = 'Error creating Tag'
        format.html { redirect_to :controller => :blog }
      end
    end
  end
  
  def destroy
    @tag = Tag.find(params[:id])
    @tag.destroy

    respond_to do |format|
      format.html { redirect_to admin_blog_posts_url }
    end
  end
  
  protected
  
  def sweep_sitemap_cache
    logger.debug "\n\n => Sweeping Sitemap Cache\n"
    expire_page("/sitemaps/tags.xml")
  end  
  
end